@extends('admin.layouts.app')
@section('css')
  <link href="{{asset('assets/plugins/responsive-table/css/rwd-table.min.css')}}" rel="stylesheet" type="text/css" media="screen">
@endsection
@section('content')


						 <div class="row">
                            <div class="col-sm-12">
                                <h4 class="page-title">平台管理</h4>
                                <ol class="breadcrumb">
                                    <li><a href="{{url('zadmin/')}}">系统</a></li>
                                    <li class="active"><a href="{{url('zadmin/users/list')}}">用户管理</a></li>
                                   
                                </ol>
                            </div>
                        </div>
						
						
						
						<div class="row">
							<div class="col-sm-12">
								<div class="card-box">
									<div class="row m-t-10 m-b-10">
			                        	<div class="col-sm-6 col-lg-8">
			                        		<form role="form" action="{{url('zadmin/users/list')}}">
			                                    <div class="form-group contact-search m-b-30">
			                  <input type="text" id="search" class="form-control" name="keyword" placeholder="姓名或手机号搜索" value="{{array_get($param,'keyword')}}">
			                                   <button type="submit" class="btn btn-white"><i class="fa fa-search"></i></button>
			                                    </div> <!-- form-group -->
			                                </form>
			                        	</div>

			                        	<!-- <div class="col-sm-6 col-lg-4">
                                            <div class="h5 m-0">
                                                <span class="vertical-middle">Sort By:</span>
                                                <div class="btn-group vertical-middle" data-toggle="buttons">
                                                     <label class="btn btn-white btn-md waves-effect active">
                                                        <input type="radio" autocomplete="off" checked=""> Status
                                                     </label>
                                                     <label class="btn btn-white btn-md waves-effect">
                                                        <input type="radio" autocomplete="off"> Type
                                                     </label>
                                                     <label class="btn btn-white btn-md waves-effect">
                                                        <input type="radio" autocomplete="off"> Name
                                                     </label>
                                                </div>
                                            </div>
                                        </div> -->

                                        
			                        </div>
									

							@if(session('rs'))
                              <div class="alert alert-{{session('rs')['status']}}">
                                {{ session('rs')['msg'] }}
                              </div>
                            @endif

									<div class="table-rep-plugin">
										<div class="table-responsive" >
											<table id="tech-companies-1" class="table  table-striped">
												<thead>
													<tr>
														<th>ID</th>
														<th>
															姓名
														</th>
														<th >微信昵称</th>
														
														<th>绑定电话</th>
														
														<th data-priority="3">收货地址</th>
													
														<th data-priority="3">订单</th>
														
														<th>状态</th>
														<th>操作</th>
													</tr>
												</thead>
												<tbody>
                        @foreach($list as $v)  
													<tr>
														<th>{{$v->id}}</th>
														<th><a href="{{url('zadmin/users/show',$v->id)}}">{{$v->name}}</a></th>
														<td>{{$v->nickname}}</td>
														
														<td>{{$v->phone}}</td>
														
														<td>
															<a href="{{url('zadmin/users/address',$v->id)}}">
																<i class="ti-flag"></i><span>用车地址</span>
															</a>	
															</td>
													
						<td>
							<a href="{{url('zadmin/order')}}?user_id={{$v->id}}">
								<i class="ti-receipt"></i><span>订单</span>
							</a>
						</td>
														
														<td><span class="label label-{{$v->status?'success':'danger'}}"> {{$v->status?'正常':'停用'}}</span></td>
														<td>
		@if($v->status==1)
		<button class="btn btn-danger btn-sm changeStatus" data-status="0" data-id="{{$v->id}}">停用</button>
        @else
		<button class="btn btn-success btn-sm changeStatus" data-status="1" data-id="{{$v->id}}">启用</button>
		@endif
		<a class="btn btn-warning btn-sm" href="{{url('zadmin/users/edit',$v->id)}}">修改</button>
														</td>
													</tr>
                        @endforeach
													
												</tbody>
											</table>
										</div>
									{{$list->appends($param)->links()}}
									</div>

								</div>
							</div>
						</div>
						<!-- end row -->



<div class="modal fade" id="statusModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
          &times;
        </button>
        <h4 class="modal-title" id="statusModalLabel">
          停用账号
        </h4>
      </div>
       <form method="post" action="{{url('zadmin/users/change-status')}}" >
       	<input name="id" type="hidden" />
       	<input name="status" type="hidden" />
      <div class="modal-body">
             
            <div class="form-group row">
                  <label class="col-md-4 control-label">备注</label>
                  <div class="col-md-8">
                    <textarea class="form-control" rows="5" name="remark" placeholder="备注" required=""></textarea>
                  </div>
                </div> 
       {{csrf_field()}}
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-default" data-dismiss="modal">关闭
        </button>
        <button type="submit" class="btn btn-primary">
          确定
        </button>
      </div>
    </form>
    </div><!-- /.modal-content -->
  </div><!-- /.modal -->
</div>
 @endsection 
               
         

    @section('js')
       <script type="text/javascript">
       	$('.changeStatus').on('click',function(){
       		var status = $(this).data('status');
       		var id = $(this).data('id');
       		var txt = status?'启用账号':'停用账号';
       		$('#statusModalLabel').text(txt);
            $('input[name="status"]').val(status);
            $('input[name="id"]').val(id);
       		$('#statusModal').modal('show');
       	});
       </script>
    @endsection    

